if (typeof String.prototype.trim !== 'function') { String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); } }
Date.prototype.midnight = function() { this.setHours(0); this.setMinutes(0); this.setSeconds(0); this.setMilliseconds(0); return this; }
if (typeof String.prototype.format !== 'function') { 
	String.prototype.format = function() {
		var args = arguments;
		return this.replace(/{(\d+)}/g, function(match, number) { 
			return typeof args[number] != 'undefined' ? args[number] : '{' + number + '}';
		})
	}
}


today = new Date().midnight();
dformat = "%d.%m.%Y";

log = (window.console && window.console.log) ?
	(window.console.log.apply && function(){window.console.log.apply(window.console, arguments)} || window.console.log) :
	function () {};

